﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

namespace Bussiness {
    public class CheckInvalid {
        public static bool isImageAllow(String fileName) {
            String ext = Path.GetExtension(fileName);
            if (ext.Equals(".png") || ext.Equals(".jpg") || ext.Equals(".jpeg") || ext.Equals(".gif") || ext.Equals(".bmp"))
                return true;
            else
                return false;
        }

        public static String convertToSlug(String text){            
            Regex regex = new Regex("\\p{IsCombiningDiacriticalMarks}+");
            string temp = text.Normalize(NormalizationForm.FormD);
            return regex.Replace(temp, String.Empty).Replace('\u0111', 'd').Replace('\u0110', 'D').Replace(' ', '-').Trim();
        }
    }
}
